package br.odb.bzk3.android;


import br.odb.libscene.Color;
import br.odb.libstrip.AbstractTriangleFactory;

public class TriangleFactory implements AbstractTriangleFactory {
	
	private static TriangleFactory instance;

	public Triangle makeTrig(short x0, short y0, short z0, short x1,

			short y1, short z1, short x2, short y2, short z2, int color) {

		Triangle toReturn = new Triangle();
		toReturn.x0 = x0;
		toReturn.x1 = x1;
		toReturn.x2 = x2;
		toReturn.y0 = y0;
		toReturn.y1 = y1;
		toReturn.y2 = y2;
		toReturn.z0 = z0;
		toReturn.z1 = z1;
		toReturn.z2 = z2;
		Color c = new Color(color);

		toReturn.r = c.getR();
		toReturn.g = c.getG();
		toReturn.b = c.getB();
		toReturn.a = c.getA();
		toReturn.init();
		return toReturn;
	}


	public Triangle makeTrig(float x0, float y0, float z0, float x1,

			float y1, float z1, float x2, float y2, float z2, int color) {
		Triangle toReturn = new Triangle();
		toReturn.x0 = x0;
		toReturn.x1 = x1;
		toReturn.x2 = x2;
		toReturn.y0 = y0;
		toReturn.y1 = y1;
		toReturn.y2 = y2;
		toReturn.z0 = z0;
		toReturn.z1 = z1;
		toReturn.z2 = z2;
		Color c = new Color(color);

		toReturn.r = c.getR();
		toReturn.g = c.getG();
		toReturn.b = c.getB();
		toReturn.a = c.getA();

		toReturn.init();
		return toReturn;		
	}

	
	public static TriangleFactory getInstance() {
		
		if ( instance == null )
			instance = new TriangleFactory();
		
		return instance;
	}
}
